#include <stdio.h>
main() {
	int i=0,Z,aa[17];
	int b[]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};
	//int c[]={0,1,2,3,4,5,6,7,8,9,10};
	char d[]={'1','0','X','9','8','7','6','5','4','3','2'};
	double s;
	//char a[]="";
	//gets(a);
	char a[17];
	gets(a);
	for(i=0;i<17;i++)aa[i]=a[i]-'1'+1;
	//s=a[0]*7+a[1]*9+a[2]*10+a[3]*5+a[4]*8+a[5]*4+a[6]*2+a[7]*1+a[8]*6+a[9]*3+a[10]*7
	for(i=0;i<17;i++)s=s+aa[i]*b[i];
	Z=(int)s%11;
	
		printf("%c",d[Z]);
	
	
}
